package schedulo.gui;

import java.io.IOException;

import javax.swing.AbstractListModel;

import schedulo.core.task.provider.TaskProvider;

public class TaskModel extends AbstractListModel {

	private TaskProvider taskProvider;
	
	public TaskModel(TaskProvider provider) {
		taskProvider = provider;
	}
	
	public Object getElementAt(int index) {
		try {
			return taskProvider.getTaskList().get(index);
		} catch (IOException e) {
			return null;
		}
	}

	public int getSize() {
		try {
			return taskProvider.getTaskList().size();
		} catch (IOException e) {
			return 0;
		}
	}
}
